package cart.api.vo;

import java.io.Serializable;
import java.util.List;

/**
 * 购物车的VO对象，整合店铺、货物等关联数据
 * Created by Liang Wenxu on 2016/10/28.
 */
public class CartVo implements Serializable {
    protected String id; // 主键

    private String userId; // 用户ID

    private Integer totalItems; // 购物车内商品总数

    private Integer totalGifts; // 总礼品数量

    private List<CartItemVo> cartItems; // 购物车商品列表

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CartVo cart = (CartVo) o;

        return !(id != null ? !id.equals(cart.id) : cart.id != null);

    }

    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }

    public List<CartItemVo> getCartItems() {
        return cartItems;
    }

    public void setCartItems(List<CartItemVo> cartItems) {
        this.cartItems = cartItems;
    }
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Integer getTotalItems() {
        return totalItems;
    }

    public void setTotalItems(Integer totalItems) {
        this.totalItems = totalItems;
    }

    public Integer getTotalGifts() {
        return totalGifts;
    }

    public void setTotalGifts(Integer totalGifts) {
        this.totalGifts = totalGifts;
    }
}
